package com.tong.hao.ac.api.model.test;

import cn.buddha.jec.model.TongBaseRequest;
import com.tong.hao.ac.api.model.RegexpConstant;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

/**
 * 请求demo
 *
 * @author 友野浩二
 */
@Setter
@Getter
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
public class DemoReq extends TongBaseRequest {

    private static final long serialVersionUID = 1865606619170433347L;

    /**
     * NotBlank 注解不需要写message，在/resources/ValidationMessages.properties文件中统一配置
     */
    @ApiModelProperty(value = "姓名", required = true, position = 0)
    @NotBlank
    private String name;

    @ApiModelProperty(value = "年龄", position = 1)
    @Min(value = 1, message = "{demoReq.age}")
    private String age;

    /**
     * Pattern 注解可以实现属性枚举值校验
     */
    @ApiModelProperty(value = "性别", position = 2, allowableValues = "G|B")
    @Pattern(regexp = RegexpConstant.TEST_DEMO_ENUM)
    private String sex;

}
